var websiteConfigCtrl  = new XFApp.client();
XFApp.client.prototype.websiteConfig = {
		successCode : 10000,	
		urlItems : {			
			updateConfigURL: basePath+"/websiteConfig/update",
			indexURL: basePath+"/websiteConfig",
		},
		
		formValidate : function(){
			$("#editForm").validate({
		        rules: {
		        	title: "required",
		        	keywords: "required",
		        	description: "required",
		        	bakNo: "required",
		        	copylimit: "required",
		        	copyright: "required",
				  },
				 messages: {
					 title: "请填写标题",
					 keywords: "请填写关键字",
					 description: "请填写描述",
					 bakNo: "请填写备案号",
					 copylimit: "请填写版权期限",
			         copyright: "请填写版权所有",
			         }
		    });
			$("#editForm").validate();
		},
		
		event : function (){			
			_this = this;
			
			$("#submitBtn").on("click",function(){				
				if($("#editForm").validate().form()){
					websiteConfigCtrl.websiteConfig.submit();
				}				
			});
			//表单验证
			_this.formValidate();	
		},		
		
		//提交
		submit : function (){		    
			
			var params = {	
            	id : $("#id").val(),
            	title: $("#title").val(),
	        	keywords: $("#keywords").val(),
	        	description: $("#description").val(),
	        	bakNo: $("#bakNo").val(),
	        	copylimit: $("#copylimit").val(),
	        	copyright: $("#copyright").val()
			}
	    	
	    	$.ajax({
	    		url :_this.urlItems.updateConfigURL,
	    		data : params,
	    		dataType : "json",
	    		type : 'post',
	    		success : function(data) {				
	    			if(data.code==_this.successCode){ 
	    				window.webDialogUtil.alert("提示",data.msg);	    				
	    				//刷新
	    				window.location.href= _this.urlItems.indexURL;    				
				    	        		
	    			}else{
	    				window.webDialogUtil.alert("提示",data.msg);
	    			}
	    		}
	    	});
		},
		
},

$(function(){	
	websiteConfigCtrl.websiteConfig.event();
});